/**
 * 
 */
package com.john.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.john.bean.Analyse_3_3Bean;
import com.john.service.base.Analyse_3_3Service;

/**
 * @author john
 *
 */
@RestController
public class Analyse_3_3Controller {
	
	@Autowired
	private Analyse_3_3Service analyse_3_3Service;
	

	@GetMapping("/getAnalyse_3_3Beans")
	private List<Analyse_3_3Bean> getAnalyse_3_3Beans() {
		
		return analyse_3_3Service.getAnalyse_3_3Beans();
	}
	
	
	/**
	 * 功能:
	 * 文件名：Analyse_3_3Controller.java
	 * @param
	 * @return JSONObject
	 * 创建时间：2019年7月20日下午4:31:44
	 * 创建者：john
	 */
	@GetMapping("/getAnalyse_3_3Beans_format")
	private JSONObject getAnalyse_3_3Beans_format() {
		List<Analyse_3_3Bean> analyse_3_3Beans = analyse_3_3Service.getAnalyse_3_3Beans();
		JSONObject json = new JSONObject();
		List<Integer> pvalue_levelList = new ArrayList<Integer>();
		List<Double> avg_priceList = new ArrayList<Double>();
		for (Analyse_3_3Bean analyse_3_3Bean : analyse_3_3Beans) {
			pvalue_levelList.add(analyse_3_3Bean.getPvalue_level());
			avg_priceList.add(analyse_3_3Bean.getAvg_price());
		}
		json.put("pvalue_level", pvalue_levelList);
		json.put("avg_price", avg_priceList);
		return json;
	}
	
}
